import axios from "utils/axios"

/*********用户信息**********/
//用户登录
let login = userVO => {
    const url = "/apis/stu/login";
    return axios.post(url, userVO, { timeout: 5000 });
}
//获取当前用户菜单
let queryCurrentUserMenus = sessionId => {
    const url = "/apis/menu/currentUserMenus";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
//获取当前学生的活动列表
let queryCurrentUserTopicList = (sessionId, queryMap) => {
    const url = '/apis/topic/queryTopicsByPage';
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//学生信息条件查询
let queryStuByPage = (sessionId, queryMap) => {
    const url = "/apis/stu/queryStuByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//用户信息新增
let saveCurrentUser = (sessionId, userVO) => {
    const url = "/apis/stu/saveCurrentUser";
    return axios.post(url, userVO, {
        headers: { "Authorization": sessionId }
    })
}
//用户信息修改
let editCurrentUser = (sessionId, userVO) => {
    const url = "/apis/stu/editCurrentUser";
    return axios.put(url, userVO, {
        headers: { "Authorization": sessionId }
    })
}
//根据ID查询当前用户信息
let queryCurrentUser = (sessionId, userId) => {
    const url = "/apis/stu/queryOne";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "userId": userId }
    })
}
//获取教职工信息
let queryTeasByPage = (sessionId, queryMap) => {
    const url = "/apis/tea/queryTeasByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//根据ID获取当前教职工信息
let queryCurrentTea = (sessionId, teaId) => {
    const url = "/apis/tea/queryOne";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "teaId": teaId }
    })
}
//编辑当前教职工信息
let editCurrentTea = (sessionId, teacher) => {
    const url = "/apis/tea/editCurrentTea";
    return axios.put(url, teacher, {
        headers: { "Authorization": sessionId },
    })
}
//新增教职工信息
let saveCurrentTea = (sessionId, teacher) => {
    const url = "/apis/tea/saveCurrentTea"
    return axios.post(url, teacher, {
        headers: { "Authorization": sessionId },
    })
}
let queryTeaListByTeaName = (sessionId, teaName) => {
    const url = "/apis/tea/queryTeaListByTeaName";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "teaName": teaName }
    })
}
//修改密码
let editPsd = (sessionId, psd) => {
    const url = "/apis/stu/editPsd";
    return axios.put(url, null, {
        headers: { "Authorization": sessionId },
        params: { "psd": psd }
    })
}
//删除当前学生信息
let delCurrentStu = (stuId) => {
    const url = "/apis/stu/delCurrentStu/" + stuId;
    return axios.delete(url);
}
//查询当前学生参加当前活动类型下的活动
let queryCurrentTopicTypeScore = (stuId) => {
    const url = "/apis/stu/queryCurrentTopicTypeScore?stuId=" + stuId;
    return axios.get(url);
}
/*********活动信息**********/
//获取活动列表
let queryTopicsByPage = (sessionId, queryMap) => {
    const url = "/apis/topic/queryByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//获取类型类型列表
let queryTopicTypes = (sessionId) => {
    const url = "/apis/topic/queryTopicTypes";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
    })
}
//获取当前活动信息详情
let queryCurrentTopicByTopicId = (sessionId, topicId) => {
    const url = "/apis/topic/queryOne";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "topicId": topicId }
    })
}
//编辑当前活动详情信息
let editCurrentTopic = (sessionId, topicVO) => {
    const url = "/apis/topic/editCurrentTopic";
    return axios.put(url, topicVO, {
        headers: { "Authorization": sessionId }
    })
}
//新增活动详情
let saveCurrentTopic = (sessionId, topicVO) => {
    const url = "/apis/topic/saveCurrentTopic";
    return axios.post(url, topicVO, {
        headers: { "Authorization": sessionId }
    })
}
//学生活动列表审核
let queryStuTopicByPage = (sessionId, queryMap) => {
    const url = "/apis/topic/queryStuTopicByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//审核当前活动
let checkedTopicState = (sessionId, stuId, topicId) => {
    const url = "/apis/topic/checkedTopicState";
    return axios.put(url, null, {
        headers: { "Authorization": sessionId },
        params: { "stuId": stuId, "topicId": topicId }
    })
}
//撤回当前活动
let cancelTopic = (sessionId, stuTopicVO) => {
    const url = "/apis/topic/cancelTopic";
    return axios.put(url, stuTopicVO, {
        headers: { "Authorization": sessionId }
    })
}
//批量审核活动
let checkTopicList = (sessionId, stuTopicListVO) => {
    const url = "/apis/topic/checkTopicList";
    return axios.put(url, stuTopicListVO, {
        headers: { "Authorization": sessionId },
    })
}
//学生自行上传活动
let uploadTopicByStu = (sessionId, topic, uploadScore) => {
    const url = "/apis/topic/uploadTopicByStu"
    return axios.post(url, topic, {
        headers: { "Authorization": sessionId },
        params: { "uploadScore": uploadScore }
    })
}
//参加当前活动
let joinCurrentTopic = (sessionId, topicId) => {
    const url = "/apis/topic/joinCurrentTopic"
    return axios.post(url, null, {
        headers: { "Authorization": sessionId },
        params: { "topicId": topicId }
    })
}
//查询当前学生参加活动信息
let queryCurrentStuTopic = (sessionId, queryMap) => {
    const url = '/apis/stu/queryCurrentStuTopic';
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//查询当前学生活动信息
let queryCurrentStuTopicDetail = (sessionId, topicId) => {
    const url = "/apis/stu/queryCurrentStuTopicDetail";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "topicId": topicId }
    })
}
//删除当前学生活动信息
let delCurrentStuTopicDetail = (sessionId, topicId) => {
    const url = "/apis/stu/delCurrentStuTopicDetail/" + topicId;
    return axios.delete(url, {
        headers: { "Authorization": sessionId },
    })
}
//编辑当前学生的上传的活动信息
let editCurrentStuTopicDetail = (sessionId, stuTopicVO) => {
    const url = "/apis/stu/editCurrentStuTopicDetail";
    return axios.put(url, stuTopicVO, {
        headers: { "Authorization": sessionId }
    })
}
//根据活动id删除活动
let delTopic = (topicId) => {
    const url = "/apis/topic/delTopic/" + topicId;
    return axios.delete(url);
}
//外部导入
let outerPortScore = (stuTopicVOS) => {
    const url = "/apis/topic/outerPortScore";
    return axios.post(url, stuTopicVOS);
}
// 活动状态审批
let approved = (topicId, status) => {
    const url = "/apis/topic/approved?topicId=" + topicId + "&status=" + status;
    return axios.put(url);
}
/*********班级信息**********/
//根据班级名称匹配班级信息
let queryClassesByClassName = (sessionId, className) => {
    const url = "/apis/class/queryByName";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "className": className }
    })
}
//班级分页查询
let queryClassesByPage = (sessionId, queryMap) => {
    const url = "/apis/class/queryClassesByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//根据ID查询班级详情信息
let queryCurrentClsByClassId = (sessionId, classId) => {
    const url = "/apis/class/queryOne";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "classId": classId }
    })
}
//新增班级信息
let saveCurrentClass = (sessionId, classes) => {
    const url = "/apis/class/saveCurrentClass";
    return axios.post(url, classes, {
        headers: { "Authorization": sessionId }
    })
}
//更新班级详情信息
let editCurrentClass = (sessionId, classes) => {
    const url = "/apis/class/editCurrentClass";
    return axios.put(url, classes, {
        headers: { "Authorization": sessionId }
    })
}
//根据班级查询该班级的所有学生
let queryCurrentClsStu = (sessionId, classId, stuName) => {
    const url = "/apis/class/queryCurrentClsStu";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "classId": classId, "stuName": stuName }
    })
}
//根据班级ID删除班级信息
let delClass = (classId) => {
    const url = "/apis/class/delClass/" + classId;
    return axios.delete(url)
}
/*********数据导出导入**********/
let importStuList2Excels = (sessionId, userVOS) => {
    const url = "/apis/stu/importStuList";
    return axios.post(url, userVOS, {
        headers: { "Authorization": sessionId }
    })
}
/*********日志管理**********/
//条件查询登录日志信息
let queryLogsByPage = (sessionId, queryMap) => {
    const url = "/apis/log/queryLogsByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//批量删除登录日志信息
let delLogsByIds = (sessionId, loginRecordIds) => {
    const url = "/apis/log/delLogs/" + loginRecordIds;
    return axios.delete(url, {
        headers: { "Authorization": sessionId },
    })
}
/*********角色管理**********/
//角色条件查询
let queryRolesByPage = (sessionId, queryMap) => {
    const url = "/apis/role/queryRolesByPage";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//查询当前角色详情
let queryCurrentRole = (sessionId, roleId) => {
    const url = "/apis/role/queryOne";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: { "roleId": roleId }
    })
}
//查询所有菜单
let queryMenus = (sessionId) => {
    const url = "/apis/menu/queryAll";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
//编辑当前角色信息
let editCurrentRole = (sessionId, role) => {
    const url = "/apis/role/editCurrentRole";
    return axios.put(url, role, {
        headers: { "Authorization": sessionId },
    })
}
//菜单授权
let authMenu = (sessionId, roleId, menuIds) => {
    const url = "/apis/role/authMenu";
    let authMenuVO = {}
    authMenuVO.roleId = roleId;
    authMenuVO.menus = menuIds;
    return axios.post(url, authMenuVO, {
        headers: { "Authorization": sessionId },
    })
}
//学生管理员授权
let authCurrentClsStuAdmin = (sessionId, stuId, clsId) => {
    const url = "/apis/class/authCurrentClsStuAdmin";
    return axios.put(url, null, {
        headers: { "Authorization": sessionId },
        params: { "stuId": stuId, "clsId": clsId }
    })
}
/*********问题反馈**********/
//发布问题
let releaseIssue = (sessionId, issue) => {
    const url = "/apis/issue/releaseIssue"
    return axios.post(url, issue, {
        headers: { "Authorization": sessionId }
    })
}
//查询最新吐槽
let queryLatestIssue = (sessionId) => {
    const url = "/apis/issue/queryLatestIssue";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
//问题反馈分页查询
let queryIssuesByPage = (sessionId, queryMap) => {
    const url = '/apis/issue/queryIssuesByPage';
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//更新反馈状态
let editIssueState = (sessionId, issueId, state) => {
    const url = "/apis/issue/editIssueState";
    return axios.put(url, null, {
        headers: { "Authorization": sessionId },
        params: { "issueId": issueId, "state": state }
    })
}
//删除吐槽
let delCurrentIssue = (sessionId, issueId) => {
    const url = "/apis/issue/delCurrentIssue/" + issueId;
    return axios.delete(url, {
        headers: { "Authorization": sessionId },
    })
}
/*********图表信息**********/
//获取当前用户大类得分
let queryTypeScore = (sessionId) => {
    const url = "/apis/stu/queryTypeScore";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
/*********处分管理**********/
//保存处分类型
let savePunish = (sessionId, punish) => {
    const url = "/apis/punish/savePunishType";
    return axios.post(url, punish, {
        headers: { "Authorization": sessionId }
    })
}
//保存学生处分
let saveCurrentStuPunish = (sessionId, stuPunishVO) => {
    const url = "/apis/stu/saveCurrentStuPunish";
    return axios.post(url, stuPunishVO, {
        headers: { "Authorization": sessionId }
    })
}
//查询所有处分类型
let queryPunishTypes = (sessionId) => {
    const url = "/apis/punish/queryAll";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
//分页查询所有学生的处分
let queryStuPunish = (sessionId, queryMap) => {
    const url = "/apis/punish/queryStuPunish";
    return axios.get(url, {
        headers: { "Authorization": sessionId },
        params: queryMap
    })
}
//删除当前处分
let delCurrentStuPunish = (sessionId, stuId, punishId, id) => {
    const url = "/apis/punish/delCurrentStuPunish";
    return axios.delete(url, {
        headers: { "Authorization": sessionId },
        params: { "stuId": stuId, "punishId": punishId, "id": id }
    })
}
//查询当前学生的处分信息
let queryCurrentStuPunish = (sessionId) => {
    const url = "/apis/punish/queryCurrentStuPunish";
    return axios.get(url, {
        headers: { "Authorization": sessionId }
    })
}
//删除处分类型
let delPunishType = punishTypeId => {
    const url = "/apis/punish/delPunishType/" + punishTypeId;
    return axios.delete(url);
}
// 处理导入
let importPunishScore = punishVOS => {
    const url = "/apis/punish/importPunishScore"
    return axios.post(url, punishVOS)
}
/*********分数导出**********/
//查询所有满足需求的学生与分数
let queryStuTotalScores = (queryMap) => {
    const url = "/apis/stu/queryStuTotalScores";
    return axios.get(url, {
        params: queryMap
    })
}
//根据学生ID删除总分表中的数据
let delExternalScore = (stuIds) => {
    const url = "/apis/stu/delExternalScore/" + stuIds;
    return axios.delete(url);
}
/*********数据观星**********/
//根据OS进行分类统计
let queryReport = () => {
    const url = "/apis/log/queryReport"
    return axios.get(url);
}
//根据Date进行分类统计
let queryReportByDate = () => {
    const url = "/apis/log/queryReportByDate"
    return axios.get(url);
}
//查询当前的登录日志
let queryLogs = () => {
    const url = "/apis/log/queryLogs"
    return axios.get(url)
}
/*********活动申请**********/
// 查询当前学生申请活动
let queryApplicationByPage = (queryMap) => {
    const url = "/apis/application/queryByPage"
    return axios.get(url, {
        params: queryMap
    })
}
// 新增申请
let insertApplication = (application) => {
    const url = "/apis/application/saveApplication";
    return axios.post(url, application)
}
// 更新申请
let updateApplication = (application) => {
    const url = "/apis/application/editApplication";
    return axios.put(url, application);
}
// 删除申请
let removeApplication = (applicationId) => {
    const url = "/apis/application/delApplication/" + applicationId;
    return axios.delete(url);
}
// 审批
let checkApplication = (application) => {
    const url = "/apis/application/checkApplication";
    return axios.put(url, application);
}
// 批量审核
let batchCheckApplications = (applicationIds) => {
    const url = "/apis/application/batchCheckApplications";
    return axios.put(url, applicationIds);
}
export {
    login, queryCurrentUserMenus, queryCurrentUserTopicList, queryTopicsByPage, queryTopicTypes, queryCurrentTopicByTopicId, editCurrentTopic, editPsd, queryStuPunish,
    saveCurrentTopic, queryStuTopicByPage, queryClassesByClassName, checkedTopicState, cancelTopic, checkTopicList, uploadTopicByStu, joinCurrentTopic, queryPunishTypes,
    queryStuByPage, saveCurrentUser, editCurrentUser, queryCurrentUser, importStuList2Excels, queryLogsByPage, delLogsByIds, queryTeasByPage, editIssueState, queryReport,
    queryCurrentTea, saveCurrentTea, editCurrentTea, queryClassesByPage, queryTeaListByTeaName, queryCurrentClsByClassId, saveCurrentClass, queryCurrentStuTopic, queryLogs,
    editCurrentClass, queryRolesByPage, queryCurrentRole, queryMenus, editCurrentRole, authMenu, releaseIssue, queryLatestIssue, queryTypeScore, savePunish, delCurrentStu,
    queryCurrentStuTopicDetail, editCurrentStuTopicDetail, delCurrentStuTopicDetail, queryCurrentClsStu, queryIssuesByPage, delCurrentIssue, authCurrentClsStuAdmin, delTopic,
    saveCurrentStuPunish, delCurrentStuPunish, queryCurrentStuPunish, queryStuTotalScores, delExternalScore, queryReportByDate, delPunishType, queryCurrentTopicTypeScore,
    importPunishScore, outerPortScore, delClass, queryApplicationByPage, insertApplication, updateApplication, removeApplication, checkApplication, batchCheckApplications, approved
}